package cn.tedu.sp02.item.service;

import cn.tedu.sp01.pojo.Item;
import cn.tedu.sp01.service.ItemService;
import org.springframework.stereotype.Service;
import lombok.extern.slf4j.Slf4j;

import java.util.ArrayList;
import java.util.List;

@Service
@Slf4j
public class ItemServiceImpl implements ItemService {
    @Override
    public List<Item> getItems(String orderId) {
        ArrayList<Item> itemArrayList = new ArrayList<>();
        itemArrayList.add(new Item(1, "商品 1", 100));
        itemArrayList.add(new Item(2, "商品 2", 200));
        itemArrayList.add(new Item(3, "商品 3", 300));
        itemArrayList.add(new Item(4, "商品 4", 400));
        itemArrayList.add(new Item(5, "商品 5", 500));
        return itemArrayList;
    }

    @Override
    public void decreaseNumbers(List<Item> list) {
        for (Item item : list) {
            log.info("减少库存 - " + item);
        }
    }
}
